package 牛客.百度.还原数列;

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int i = sc.nextInt();
        int sum = 0;
        int nums[] = new int[i];
        for(int a = 0;a<i;a++){
            nums[a] = sc.nextInt();
        }
        Arrays.sort(nums);
        while(nums[nums.length-1]>= i){
            nums[nums.length-1] = nums[nums.length-1]-i;
            sum++;
            for(int am= 0;i<nums.length;i++){
                nums[am] = nums[am]+1;
            }
            Arrays.sort(nums);
        }
        System.out.println(sum);
    }
}
